package TOP101;

/**
 * @Question BM19
 * @Date 2022/11/8 21:30
 * @Solution
 */
public class BM19 {
    public int findPeakElement (int[] nums) {
        int right=nums.length-1;
        int left=0;
        while(left<=right) {
            int mid=(right+left)/2;
            if(nums[mid]<nums[mid+1]) {
                left=mid+1;
            } else if(nums[mid]>nums[mid+1]){
                right=mid;
            }
        }
        return right;
    }
}
